package com.kkb.service;

import com.kkb.dao.TeamDao;
import com.kkb.po.Team;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TeamServiceImpl implements TeamService {

    @Autowired
    private TeamDao teamDao;

    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED,rollbackFor = {Exception.class})
    @Override
    public int insertTeam(Team team) {//执行两次插入操作
        teamDao.insertTeam(team);
        int num = 1/0;
        teamDao.insertTeam(team);
        return 0;
    }

    @Override
    public int updateTeam(Team team) {
        return 0;
    }

    @Override
    public int deleteTeam(Team team) {
        return 0;
    }

    @Override
    public Team findTeamById(int teamId) {
        return null;
    }
}
